﻿@model LeadMaster.Models.Diary

@Html.Label("Schedule a diary entry for :")

<p class="diaryinfo">
@ViewBag.contact
</p>
@using (Ajax.BeginForm("Diary", "Leads",
    new AjaxOptions
    {
        InsertionMode = InsertionMode.Replace,
        HttpMethod = "POST",
        LoadingElementId = "ajax-loader"
    },
    new { id="diarypopup" }))
{
@Html.HiddenFor(model => model.LeadID)
@Html.HiddenFor(model => model.CompanyID)
@Html.HiddenFor(model => model.ContactID)

<div>
@Html.Label("Notes")
@Html.TextAreaFor(model => model.Notes, new { @class = "notes" })
</div>
<div class="spacer"></div> 
<div>
@Html.Label("When")
<input type="text" id="Scheduled" name="Scheduled" class="datepicker" value="@(Model.Scheduled.ToShortDateString())" />
</div>
<div class="spacer"></div> 
<div>
@Html.Label("Method")
@Html.RadioButtonFor(model => model.ContactType, "E") Email
@Html.RadioButtonFor(model => model.ContactType, "T") Telephone
@Html.RadioButtonFor(model => model.ContactType, "M") Meeting
@Html.RadioButtonFor(model => model.ContactType, "O") Other
</div>
<div class="spacer"></div> 
<input type="button" value="Schedule" id="diarysubmit"/>
<img id="ajax-loader"
    src="@Url.Content("~/Images/ajaxspinner_large.gif")"
    style="display:none" />
}

<script type="text/javascript">
    $().ready(function () {

        $("#diarysubmit").click(function () {
            $("#diarypopup").submit();
            $('#diary').dialog("close");
        });

        $(".datepicker").datepicker({
            changeMonth: true,
            changeYear: true,
            yearRange: '-100',
            regional: 'en-GB',
            dateFormat: 'dd/mm/yy'
        });

    });
</script>